package com.guagua.vas.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class StringUtil {
	
	public static String StringDecodeUtf8(String str){
		if(str!=null && !str.equals("")){
			try {
				str = URLDecoder.decode(str,"utf-8");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}else{
			str = "";
		}
		return str;
	}
	
	public static String StringEncodeUtf8(String str){
		if(str!=null && !str.equals("")){
			try {
				str = URLEncoder.encode(str,"utf-8");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}else{
			str = "";
		}
		return str;
	}

}
